package com.activitycode.datamodel.model;

import org.json.*;
import java.util.ArrayList;

public class DetailPetDetailBase {
	
    private boolean result;
    private ArrayList<DetailPetImages> petImages;
    private DetailPetInfo petInfo;
    private DetailPetImages petImg;
    
	public DetailPetDetailBase () {
		
	}	
        
    public DetailPetDetailBase (JSONObject json) {
    
        this.result = json.optBoolean("result");

        this.petImages = new ArrayList<DetailPetImages>();
        JSONArray arrayPetImages = json.optJSONArray("pet_images");
        if (null != arrayPetImages) {
            int petImagesLength = arrayPetImages.length();
            for (int i = 0; i < petImagesLength; i++) {
                JSONObject item = arrayPetImages.optJSONObject(i);
                if (null != item) {
                    this.petImages.add(new DetailPetImages(item));
                }
            }
        }
        else {
            JSONObject item = json.optJSONObject("pet_images");
            if (null != item) {
                this.petImages.add(new DetailPetImages(item));
            }
        }
        JSONObject jsInfo = json.optJSONObject("pet_info");
        if(jsInfo!=null){
        	 this.petInfo = new DetailPetInfo(jsInfo);
        }
       
        JSONObject jsMsg = json.optJSONObject("msg");
        if(jsMsg!=null){
        	this.petImg = new DetailPetImages(jsMsg);
        }
        

    }
    
    public boolean getResult() {
        return this.result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public ArrayList<DetailPetImages> getPetImages() {
        return this.petImages;
    }

    public void setPetImages(ArrayList<DetailPetImages> petImages) {
        this.petImages = petImages;
    }

    public DetailPetInfo getPetInfo() {
        return this.petInfo;
    }

    public void setPetInfo(DetailPetInfo petInfo) {
        this.petInfo = petInfo;
    }
    
    public DetailPetImages getDetailPetImages() {
        return this.petImg;
    }

    public void setDetailPetImages(DetailPetImages petInfo) {
        this.petImg = petInfo;
    }


    
}
